cmake_minimum_required(VERSION 3.27)
project(TestStencil)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

# 添加QML调试标志
#add_compile_definitions(QT_QML_DEBUG)
#if(CMAKE_BUILD_TYPE STREQUAL "Debug")
#    add_definitions(-DQT_QML_DEBUG)
#endif()

set(CMAKE_PREFIX_PATH "D:/Qt/5.12.5/msvc2017_64/lib/cmake")

include_directories("external" "external/glm/include" "external/glad/include"
					"D:/3d_lib_dir/glfw/include" "D:/3d_lib_dir/assimp/include")
link_directories("D:/3d_lib_dir/glfw/lib" "D:/3d_lib_dir/assimp/lib")

# 添加不参与编译的资源文件到工程中
function(add_folder_as_target folder)
  file(GLOB FILES "${folder}/*")
	string(REPLACE "/" "_" target_name ${folder})
  add_custom_target(${target_name} SOURCES ${FILES})
endfunction()
add_folder_as_target("res")

# 添加参与编译执行的目录
file(GLOB_RECURSE SRC_FILES "src/*")
file(GLOB_RECURSE INCLUDE_FILES "external/src/*")
add_executable(${PROJECT_NAME} ${SRC_FILES} ${INCLUDE_FILES} main.cpp)

find_package(Qt5 COMPONENTS Core Quick Qml Gui Concurrent REQUIRED)
find_package(OpenGL REQUIRED) #OpenGL not Qt5 OpenGL

#if (OPENGL_FOUND)
#    message(STATUS "OpenGL found: ${OPENGL_LIBRARIES}")
#else()
#    message(FATAL_ERROR "OpenGL not found!")

target_link_libraries(${PROJECT_NAME}
		Qt5::Core Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Concurrent
		${OPENGL_LIBRARIES} glfw3dll.lib assimp-vc143-mt.lib
)

#add_definitions(-D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)